Answer:

The old contents of stuff.txt are entirely replaced with the new output.

Printing a Program's Output

One way to print the output of a program is to redirect its output to a text file (as in the previous page), then read the file into Notepad or other editor, then use the editor's print command. Here is a Hello.java program that can be copy to a source file and run to practice redirection.

class Hello
{
  public static void main ( String[] args )
  {
    System.out.println("Hello World");
  }
}

Here is a program being used with output redirection:

C:\temp>javac Hello.java

C:\temp>java Hello > output.txt

C:\temp>type output.txt
Hello World

C:\temp>

Of course, you will probably be in a different subdirectory when you do this.

QUESTION 10:

After the above commands have been executed, what happens to the file called output.txt in the subdirectory C:\Myfiles ?